package com.aura.blog.dto.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

/**
 * 博客信息响应对象
 * 用于封装博客信息的响应数据
 */
@Data
@Schema(description = "博客信息响应对象")
public class BlogInfoResponse {
    
    @Schema(description = "博客ID")
    private Integer id;
    
    @Schema(description = "博客标题")
    private String title;
    
    @Schema(description = "博客内容")
    private String content;
    
    @Schema(description = "作者ID")
    private Integer userId;

    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    @Schema(description = "创建时间")
    private Date createTime;

//    public String getCreateTime() {
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        return dateFormat.format(createTime);
//    }

//    public String getContent() {
//        return content.length()>100?content.substring(0,100): content;
//    }
}